Xbasic

UI_EXPAND_BRANCHES Function

Syntax

Formatted_Menu as C = UI_EXPAND_BRANCHES(C branches)

Arguments

Formatted_Menu

A character string suitable for display by UI_TOP_MEN().

branches

A menu definition as produced by the Menu Maker.

Description

Expand branches - lines containing {=<expr>} get expanded to include lines generated.

Discussion

The UI_EXPAND_BRANCHES() function is used to expand certain menu 'macros' (such as recent file list, or window list) at runtime.

Example

The following pieces of code are from the MDI Xdialog Framework Xdialog lesson.

dim menu_string as C
event_string = <<%code%
if left(a_command,3) = "A5." then
    a5.command(substr(a_command,4) )
    a_command = ""
else if left(a_command,1) = "!" then
    evaluate_template(substr(a_command,2) )
    a_command = ""
else if left(a_command,6) = "addin:" then
    evaluate_template(substr(a_command,7) )
else if left(a_command,8) = "command:" then
    ui_dlg_event(dlg_title,substr(a_command,9) )
else if .not. ("|" $ a_command) then
    this.command(a_command)
    a_command = ""
end if
%code%
menu_string = a5_menu_def_load("MDI_test")
if a_dlg_button = "activate" then 'show the menu
    ui_top_menu(ui_expand_branches(menu_string), event_string)
end if

Limitations

Desktop applications only.

See Also